<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"> <style>
	.KEYW {color: #933;}
	.COMM {color: #bbb; font-style: italic;}
	.NUMB {color: #393;}
	.STRN {color: #393;}
	.REGX {color: #339;}
	.line {border-right: 1px dotted #666; color: #666; font-style: normal;}
	</style></head><body><pre><span class='line'>  1</span> <span class="COMM">/**
<span class='line'>  2</span>  * 面板控件
<span class='line'>  3</span>  * @example 示例:
<span class='line'>  4</span> tip = FDLib.getEl('tip');
<span class='line'>  5</span> win = new FDPanel({
<span class='line'>  6</span> 	domId:'win'
<span class='line'>  7</span> 	,title:'标题'
<span class='line'>  8</span> 	,isSlide:true
<span class='line'>  9</span> 	,width:'500px'
<span class='line'> 10</span> 	,height:'300px'
<span class='line'> 11</span> });
<span class='line'> 12</span> win3 = new FDPanel({
<span class='line'> 13</span> 	domId:'win3'
<span class='line'> 14</span> 	,title:'标题3'
<span class='line'> 15</span> });
<span class='line'> 16</span>  * @param options 参见{@link #getOptions}返回的对象
<span class='line'> 17</span>  * @constructor
<span class='line'> 18</span>  * 2012-8-12
<span class='line'> 19</span>  */</span><span class="WHIT">
<span class='line'> 20</span> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">FDPanel</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">options</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 21</span> </span><span class="WHIT">	</span><span class="NAME">FDLib.implement</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">,</span><span class="NAME">FDControl</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 22</span> </span><span class="WHIT">	</span><span class="NAME">this.options</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">FDLib.util.apply</span><span class="PUNC">(</span><span class="NAME">this.getOptions</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="NAME">options</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 23</span> </span><span class="WHIT">	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">view</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.options.view</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 24</span> </span><span class="WHIT">	</span><span class="COMM">/** 视图层实例 */</span><span class="WHIT">
<span class='line'> 25</span> </span><span class="WHIT">	</span><span class="NAME">this.viewInstance</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">view</span><span class="PUNC">(</span><span class="NAME">this.options</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 26</span> </span><span class="WHIT">	</span><span class="WHIT">
<span class='line'> 27</span> </span><span class="WHIT">	</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">this.options.isLoadShow</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 28</span> </span><span class="WHIT">		</span><span class="NAME">this.show</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 29</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 30</span> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 31</span> 
<span class='line'> 32</span> </span><span class="NAME">FDPanel.prototype</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 33</span> </span><span class="COMM">/**
<span class='line'> 34</span>  * 默认属性
<span class='line'> 35</span>  * &lt;pre>&lt;/code>
<span class='line'> 36</span> {
<span class='line'> 37</span> 	// 节点ID
<span class='line'> 38</span> 	domId:''
<span class='line'> 39</span> 	// 标题
<span class='line'> 40</span> 	,title:''
<span class='line'> 41</span> 	//视图层类 
<span class='line'> 42</span> 	,view:FDPanelView
<span class='line'> 43</span> 	//是否可以展开/关闭 
<span class='line'> 44</span> 	,isSlide:false
<span class='line'> 45</span> 	// 是否立即展开
<span class='line'> 46</span> 	,isExpand:true
<span class='line'> 47</span> 	// 立即显示 
<span class='line'> 48</span> 	,isLoadShow:true
<span class='line'> 49</span> 	,width:null
<span class='line'> 50</span> 	,height:null
<span class='line'> 51</span> 	// 是否显示关闭按钮 
<span class='line'> 52</span> 	,closeable:false
<span class='line'> 53</span> 	// 是否可以伸缩
<span class='line'> 54</span> 	,toggleable:false
<span class='line'> 55</span> }&lt;/code>&lt;/pre>
<span class='line'> 56</span>  */</span><span class="WHIT">
<span class='line'> 57</span> </span><span class="WHIT">	</span><span class="NAME">getOptions</span><span class="PUNC">:</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 58</span> </span><span class="WHIT">		</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 59</span> </span><span class="WHIT">			</span><span class="NAME">domId</span><span class="PUNC">:</span><span class="STRN">''</span><span class="WHIT">
<span class='line'> 60</span> </span><span class="WHIT">			</span><span class="COMM">/** 标题 */</span><span class="WHIT">
<span class='line'> 61</span> </span><span class="WHIT">			</span><span class="PUNC">,</span><span class="NAME">title</span><span class="PUNC">:</span><span class="STRN">''</span><span class="WHIT">
<span class='line'> 62</span> </span><span class="WHIT">			</span><span class="COMM">/** 视图层类 */</span><span class="WHIT">
<span class='line'> 63</span> </span><span class="WHIT">			</span><span class="PUNC">,</span><span class="NAME">view</span><span class="PUNC">:</span><span class="NAME">FDPanelDomView</span><span class="WHIT">
<span class='line'> 64</span> </span><span class="WHIT">			</span><span class="COMM">/** 是否可以展开/关闭 */</span><span class="WHIT">
<span class='line'> 65</span> </span><span class="WHIT">			</span><span class="PUNC">,</span><span class="NAME">isSlide</span><span class="PUNC">:</span><span class="KEYW">false</span><span class="WHIT">
<span class='line'> 66</span> </span><span class="WHIT">			</span><span class="COMM">/** 是否立即展开 */</span><span class="WHIT">
<span class='line'> 67</span> </span><span class="WHIT">			</span><span class="PUNC">,</span><span class="NAME">isExpand</span><span class="PUNC">:</span><span class="KEYW">true</span><span class="WHIT">
<span class='line'> 68</span> </span><span class="WHIT">			</span><span class="COMM">/** 立即显示 */</span><span class="WHIT">
<span class='line'> 69</span> </span><span class="WHIT">			</span><span class="PUNC">,</span><span class="NAME">isLoadShow</span><span class="PUNC">:</span><span class="KEYW">true</span><span class="WHIT">
<span class='line'> 70</span> </span><span class="WHIT">			</span><span class="PUNC">,</span><span class="NAME">width</span><span class="PUNC">:</span><span class="KEYW">null</span><span class="WHIT">
<span class='line'> 71</span> </span><span class="WHIT">			</span><span class="PUNC">,</span><span class="NAME">height</span><span class="PUNC">:</span><span class="KEYW">null</span><span class="WHIT">
<span class='line'> 72</span> </span><span class="WHIT">			</span><span class="COMM">/** 是否显示关闭按钮 */</span><span class="WHIT">
<span class='line'> 73</span> </span><span class="WHIT">			</span><span class="PUNC">,</span><span class="NAME">closeable</span><span class="PUNC">:</span><span class="KEYW">false</span><span class="WHIT">
<span class='line'> 74</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 75</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 76</span> </span><span class="WHIT">	</span><span class="COMM">/**
<span class='line'> 77</span> 	 * 显示窗体
<span class='line'> 78</span> 	 * @param callback 显示后的回调函数,与afterShow不冲突
<span class='line'> 79</span> 	 */</span><span class="WHIT">
<span class='line'> 80</span> </span><span class="WHIT">	</span><span class="PUNC">,</span><span class="NAME">show</span><span class="PUNC">:</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">callback</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 81</span> </span><span class="WHIT">		</span><span class="NAME">this.viewInstance.show</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 82</span> </span><span class="WHIT">		</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">FDLib.util.isFunction</span><span class="PUNC">(</span><span class="NAME">callback</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 83</span> </span><span class="WHIT">			</span><span class="NAME">callback</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 84</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 85</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 86</span> </span><span class="WHIT">	</span><span class="COMM">/**
<span class='line'> 87</span> 	 * 关闭窗体
<span class='line'> 88</span> 	 * @param callback 关闭后的回调函数,与afterClose不冲突
<span class='line'> 89</span> 	 */</span><span class="WHIT">
<span class='line'> 90</span> </span><span class="WHIT">	</span><span class="PUNC">,</span><span class="NAME">hide</span><span class="PUNC">:</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">callback</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 91</span> </span><span class="WHIT">		</span><span class="NAME">this.viewInstance.close</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 92</span> </span><span class="WHIT">		</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">FDLib.util.isFunction</span><span class="PUNC">(</span><span class="NAME">callback</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 93</span> </span><span class="WHIT">			</span><span class="NAME">callback</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 94</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 95</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 96</span> </span><span class="WHIT">	</span><span class="COMM">/**
<span class='line'> 97</span> 	 * 等同hide()
<span class='line'> 98</span> 	 */</span><span class="WHIT">
<span class='line'> 99</span> </span><span class="WHIT">	</span><span class="PUNC">,</span><span class="NAME">close</span><span class="PUNC">:</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">callback</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>100</span> </span><span class="WHIT">		</span><span class="NAME">this.hide</span><span class="PUNC">(</span><span class="NAME">callback</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>101</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>102</span> </span><span class="WHIT">	</span><span class="COMM">/**
<span class='line'>103</span> 	 * 设置面板的width属性
<span class='line'>104</span> 	 * @param width 字符串类型,如:'120px'
<span class='line'>105</span> 	 */</span><span class="WHIT">
<span class='line'>106</span> </span><span class="WHIT">	</span><span class="PUNC">,</span><span class="NAME">setWidth</span><span class="PUNC">:</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">width</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>107</span> </span><span class="WHIT">		</span><span class="NAME">this.viewInstance.setWidth</span><span class="PUNC">(</span><span class="NAME">width</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>108</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>109</span> </span><span class="WHIT">	</span><span class="COMM">/**
<span class='line'>110</span> 	 * 设置面板的height属性
<span class='line'>111</span> 	 * @param height 字符串类型,如:'120px'
<span class='line'>112</span> 	 */</span><span class="WHIT">
<span class='line'>113</span> </span><span class="WHIT">	</span><span class="PUNC">,</span><span class="NAME">setHeight</span><span class="PUNC">:</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">height</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>114</span> </span><span class="WHIT">		</span><span class="NAME">this.viewInstance.setHeight</span><span class="PUNC">(</span><span class="NAME">height</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>115</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>116</span> </span><span class="WHIT">	</span><span class="COMM">/**
<span class='line'>117</span> 	 * 设置标题
<span class='line'>118</span> 	 * @param title 标题
<span class='line'>119</span> 	 */</span><span class="WHIT">
<span class='line'>120</span> </span><span class="WHIT">	</span><span class="PUNC">,</span><span class="NAME">setTitle</span><span class="PUNC">:</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">title</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>121</span> </span><span class="WHIT">		</span><span class="NAME">this.viewInstance.setTitle</span><span class="PUNC">(</span><span class="NAME">title</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>122</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>123</span> </span><span class="WHIT">	</span><span class="COMM">/**
<span class='line'>124</span> 	 * 设置窗体内容
<span class='line'>125</span> 	 * @param content 内容,字符串类型
<span class='line'>126</span> 	 */</span><span class="WHIT">
<span class='line'>127</span> </span><span class="WHIT">	</span><span class="PUNC">,</span><span class="NAME">setContent</span><span class="PUNC">:</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">content</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>128</span> </span><span class="WHIT">		</span><span class="NAME">this.viewInstance.setContent</span><span class="PUNC">(</span><span class="NAME">content</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>129</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>130</span> </span><span class="PUNC">}</span></pre></body></html>